package sjms.behavior.china;

/**
 * @ClassName:
 * @Description:
 * @Author fcb
 * @Date 2020/6/5 14:51
 */
public class Test {

    // 构建责任链
    public static AbstractLogger setChina(){
        AbstractLogger error = new ErrorLogger(AbstractLogger.ERROR);
        AbstractLogger debug = new DebugLogger(AbstractLogger.DEBUG);
        AbstractLogger info = new InfoLogger(AbstractLogger.INFO);

        error.setNextLogger(debug);
        debug.setNextLogger(info);

        return error;
    }

    public static void main(String[] args) {
        AbstractLogger log = setChina();

        log.log(AbstractLogger.INFO, "info");

        log.log(AbstractLogger.DEBUG,"debug");
        log.log(AbstractLogger.ERROR, "error");
    }
}
